﻿using Shop.RemoteModel.ActivityGoods;
using Shop.RemoteModel.ActivityGoods.Model;
using Shop.StoreGatewayModular.Interface;
using Shop.StoreGatewayModular.Model.ActivityGoods;

namespace Shop.StoreGatewayModular.Service
{
    internal class ActivityGoodsService : IActivityGoodsService
    {
        public ActivityGoodsDto[] Gets (long activityId)
        {
            return new GetsActivityGoods
            {
                ActivityId = activityId,
            }.Send();
        }
        public void Delete (long id)
        {
            new DeleteActivityGoods
            {
                Id = id,
            }.Send();
        }
        public bool SetPrice (long id, decimal price, bool isMust)
        {
            return new SetActivityGoodsPrice
            {
                Id = id,
                Price = price,
                IsMust = isMust,
            }.Send();
        }
        public ActivityGoodsDto[] Set (long activityId, ActivityGoods[] goods)
        {
            return new SetActivityGoods
            {
                ActivityId = activityId,
                Goods = goods
            }.Send();
        }

        public void Delete (long id, long[] ids)
        {
            new BatchDeleteActivityGoods
            {
                ActivityId = id,
                Ids = ids
            }.Send();
        }

        public void BatchSetPrice (long id, SetPrice[] price)
        {
            new BatchSetActivityGoodsPrice
            {
                ActivityId = id,
                Price = price.ToDictionary(a => a.Id, a => a.Price),
            }.Send();
        }
    }
}
